import { tableFilePreview } from "./common";

// 审核状态
export const checkStatusRend: any = ({ row }) => (
  <div>
    {row.examineStatus === 0 ? (
      <el-tag type="warning">审核中</el-tag>
    ) : row.examineStatus === 1 ? (
      <el-tag type="primary">已审核</el-tag>
    ) : (
      <el-tag type="danger">已驳回</el-tag>
    )}
  </div>
);

// 状态
export const dataStatusRend: any = ({ row }) => (
  <div>{row.status == 1 ? "进行中" : "已完成"}</div>
);

// 驳回原因
export const rejectDescRend: any = ({ row }) => (
  <div>{row.examineDesc || "--"}</div>
);

const getClassNames = fileData => {
  let classStr = "cursor-pointer font-bold ";
  classStr += fileData ? "text-[#409EFF]" : "text-gray-400";
  return classStr;
};

// 附件
export const tableFileRend: any = (row, fileKey) => (
  // <el-button text type="primary" onClick={() => tableFilePreview(row, fileKey)}>
  //   查看附件
  // </el-button>
  <div
    className={getClassNames(row[fileKey])}
    onClick={() => tableFilePreview(row, fileKey)}
  >
    查看附件
  </div>
);
